<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<title>找回密码 - {$feifeicms.site_name} </title>
	<meta name="keywords" content="{$feifeicms.site_keywords}"/>
	<meta name="description" content="{$feifeicms.site_description}"/>
	{include file="block/include"}
	{include file="user/include" /}
</head>
<body class="padding-0">
	
<div class="stui_login__form clearfix">
	<div class="stui-pannel stui-pannel-bg clearfix">
		<div class="stui-pannel-box clearfix">		
			<div class="stui-pannel_bd">
				<div class="head">
					<a href="{$feifeicms.path}"><img src="{$feifeicms.site_logo|ffcms_default='statics/img/logo.png'|ffcms_url_img}"/></a>
					<h4 class="margin-0">预留问题找回密码</h4>
				</div>
				<ul class="input-list">				
					<form method="post" id="fm" action="">					
						<li>
							<input type="text" id="user_name" name="user_name" class="form-control" placeholder="请输入您的登录账号">
						</li>
						<li>
							<input type="text" id="user_question" name="user_question" class="form-control" placeholder="请输入您密码找回问题">
						</li>
						<li>
							<input type="text" id="user_answer" name="user_answer" class="form-control" placeholder="请输入您的密码找回答案">
						</li>
						<li>
							<input type="password" id="user_pwd" name="user_pwd" class="form-control" placeholder="请输入您的新密码">
						</li>
						<li>
							<input type="password" id="user_pwd2" name="user_pwd2" class="form-control" placeholder="请输入您的确认密码">
						</li>
						<li>
							<button type="button" id="btn_submit" class="btn btn-lg btn-block btn-primary">立即登录</button>
						</li>
						<li class="text-center">
							<a href="{:url('user/login')}">登录账号</a><span class="split-line"></span><a href="{:url('user/findpass_msg')}?ac=email">用邮箱找回</a><span class="split-line"></span><a href="{:url('user/findpass_msg')}?ac=phone">用手机找回</a>
						</li>
					</form>
				</ul>			
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">

	$(function(){
		$("body").bind('keyup',function(event) {
			if(event.keyCode==13){ $('#btn_submit').click(); }
		});
		$('#btn_submit').click(function() {
			if ($('#user_name').val()  == '') { alert('请输入用户！'); $("#user_name").focus(); return false; }
			if ($('#user_pwd').val()  == '') { alert('请输入密码！'); $("#user_pwd").focus(); return false; }
			if ($('#verify').val()  == '') { alert('请输入验证码！'); $("#verify").focus(); return false; }

			$.ajax({
				url: "{:url('user/findpass')}",
				type: "post",
				dataType: "json",
				data: $('#fm').serialize(),
				beforeSend: function () {
					$("#btn_submit").css("background","#fd6a6a").val("loading...");
				},
				success: function (r) {
					if(r.code==1){
						location.href="{:url('user/index')}";
					}
					else{
						alert(r.msg);
					}
				},
				complete: function () {
					$('#verify').click();
					$("#btn_submit").css("background","#fa4646").val("立即找回");
				}
			});

		});
	});

</script>

</body>
</html>